//Source file: D:\\test\\com\\ce\\pms\\charge\\model\\SchDetail.java

package com.ce.pms.charge.model;

import javax.persistence.*;

import com.ce.pms.exception.BusinessException;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:方案明细 关联数据表:FEE_SCH_DETAIL
 * @author Adama Yue
 * @CreateDate:2008-7-11
 */
@Entity
@Table(name = "FEE_SCH_DETAIL")
public class SchDetail implements IDomainObject{

	/**
	 * 主键
	 */
	@Id
	@GeneratedValue
	@Column(name = "SCH_DETAIL_ID")
	private Long schDetailId;

	/**
	 * 预交方案
	 */
	@ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="PAY_SCHEME_ID",nullable = false)
	private PrePaySchDomain prePaySch;

	/**
	 * 收费项目
	 */
	@ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="CHAR_ITEM_ID",nullable = false)
	private ChargeItemDomain chargeItem;

	/**
	 * 序号
	 */
	@Column(name="SEQENCE",nullable = false)
	private Short seqence;

	/**
	 * @roseuid 48757D17002E
	 */
	public SchDetail() {

	}

	public SchDetail(PrePaySchDomain prePaySch, ChargeItemDomain chargeItem, Short seqence) {
		super();
		this.prePaySch = prePaySch;
		this.chargeItem = chargeItem;
		this.seqence = seqence;
	}
	/*********************************************
	 * Accessors and modifiers
	 *********************************************/

	public ChargeItemDomain getChargeItem() {
		return chargeItem;
	}

	public void setChargeItem(ChargeItemDomain chargeItem) {
		this.chargeItem = chargeItem;
	}

	public PrePaySchDomain getPrePaySch() {
		return prePaySch;
	}

	public void setPrePaySch(PrePaySchDomain prePaySch) {
		this.prePaySch = prePaySch;
	}

	public Long getSchDetailId() {
		return schDetailId;
	}

	public void setSchDetailId(Long schDetailId) {
		this.schDetailId = schDetailId;
	}

	public Short getSeqence() {
		return seqence;
	}

	public void setSeqence(Short seqence) {
		this.seqence = seqence;
	}

	/**
	 *
	 * 功能描述: 判断必填项是否有值
	 *
	 * @author 付湘辉
	 * Created on:2008-7-11
	 *
	 * 修改原因：
	 * @return void 返回结果
	 */
	public void checkRequiredField() {
		if (this.chargeItem == null
				|| this.prePaySch == null
				|| this.seqence == null) {
			throw new BusinessException("common:mustFill_null_exception",
					BusinessException.WARNING);
		}

	}
}
